package com.ey12.file;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

//import org.smartlib.pool.core.SmartPoolFactory;

public class DBPoolFactory {

//	public static SmartPoolFactory smp = null;
	public static String URL = "";
	public static String USN = "";
	public static String PWD = "";
	
//	public static void initSmartPoolFactory() {
//		if (smp == null) {
//			try{
//				System.out.println("initSmartPoolFactory SmartPoolFactory done!");
//				smp = new SmartPoolFactory("pool-config.xml");
//			}catch(Exception e){
//				e.printStackTrace();
//			}
//		}
//	}
//	
//	public static SmartPoolFactory getSmartPoolFactory() {
//		return smp;
//	}
//	
//	public static Connection getConnectionByPool() {
//		try{
//			return SmartPoolFactory.getConnection("MysqlPool");
//		}catch(Exception e){
//			e.printStackTrace();
//		}
//		return null;
//	}
	
	public static Connection getConnectionByJDBC() {
		Connection conn = null;
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		try {
			conn = DriverManager.getConnection(URL, USN, PWD);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return conn;
	}
}
